# Group Tickets
Related to tickets (free, paid, donation) to the event.

| Parameter | Description | Type | Required |
|:----------|-------------|------|----------|
| `name`  | Name of the ticket | string | **yes** |
| `type` | Type of the ticket | string | **yes** |
| `description` | Description of the ticket | string | - |
| `price` | Price of the ticket | float | - |
| `quantity` | Total quantity of the ticket | integer | - |
| `min-order` | Min order of the ticket | string | - |
| `max-order` | Max order of the ticket | string | - |
| `position` | Position of the ticket | string | - |
| `sales-starts-at` | Start date of ticket sale | ISO 8601 (tz-aware) | **yes** |
| `sales-ends-at` | End date of ticket sale | ISO 8601 (tz-aware) | **yes** |
| `is-description-visible` | Yes/No to enter description | boolean (default: `false`) | - |
| `is-checkin-restricted` | Yes/No to checkin restriction | boolean (deault: `true`) | - |
| `auto-checkin-enabled` | Yes/No to enable auto checkin | boolean (default: `false`) | - |
| `is-hidden` | Yes/No to hide ticket | boolean (default: `false`) | - |
| `is-fee-absorbed` | Yes/No for ticket absorption | boolean (default: `false`) | - |

## Tickets Collection [/v1/tickets{?page%5bsize%5d,page%5bnumber%5d,sort,filter}]
+ Parameters
    + page%5bsize%5d (optional, integer, `10`) - Maximum number of resources in a single paginated response.
    + page%5bnumber%5d (optional, integer, `2`) - Page number to fetched for the paginated response.
    + sort (optional, string, `sales-starts-at`) - Sort the resources according to the given attribute in ascending order. Append '-' to sort in descending order.
    + filter (optional, string, `[]`) - Filter according to the flask-rest-jsonapi filtering system. Please refer: http://flask-rest-jsonapi.readthedocs.io/en/latest/filtering.html for more.

### Create Ticket [POST]
Create a new ticket using an event_id.

+ Request (application/vnd.api+json)

    + Headers

            Authorization: JWT <Auth Key>

    + Body

            {
                "data": {
                    "relationships":{
                        "event":{
                            "data":{
                             "type":"event",
                             "id":"1"
                            }
                        }
                     },
                    "attributes": {
                        "name": "ticket-name",
                        "description": "some description",
                        "type": "VIP-ticket",
                        "price": "100.00",
                        "quantity": "100",
                        "is-description-visible": "false",
                        "is-checkin-restricted": "true",
                        "auto-checkin-enabled": "false",
                        "position": "1",
                        "is-fee-absorbed": "false",
                        "sales-starts-at": "2017-06-01T01:24:47.500127+00:00",
                        "sales-ends-at": "2017-06-30T00:24:47.500127+00:00",
                        "is-hidden": "false",
                        "min-order": "1",
                        "max-order": "100"
                    },
                    "type": "ticket"
                }
            }


+ Response 201 (application/vnd.api+json)

        {
            "data": {
                "relationships": {
                    "ticket-tags": {
                        "links": {
                            "self": "/v1/tickets/1/relationships/ticket-tags",
                            "related": "/v1/tickets/1/ticket-tags"
                        }
                    },
                    "access-codes": {
                        "links": {
                            "self": "/v1/tickets/1/relationships/access-codes",
                            "related": "/v1/tickets/1/access-codes"
                        }
                    },
                    "event": {
                        "links": {
                            "self": "/v1/tickets/1/relationships/event",
                            "related": "/v1/tickets/1/event"
                        }
                    },
                    "discount-codes": {
                        "links": {
                            "self": "/v1/tickets/1/relationships/discount-codes",
                            "related": "/v1/tickets/1/discount-codes"
                        }
                    }
                },
                "attributes": {
                    "description": "some description",
                    "type": "VIP-ticket",
                    "price": 100,
                    "name": "ticket-name",
                    "max-order": 100,
                    "is-description-visible": false,
                    "is-checkin-restricted": "true",
                    "auto-checkin-enabled": "false",
                    "is-fee-absorbed": false,
                    "position": 1,
                    "quantity": 100,
                    "is-hidden": false,
                    "deleted-at": null,
                    "sales-ends-at": "2017-06-30T00:24:47.500127+00:00",
                    "min-order": 1,
                    "sales-starts-at": "2017-06-01T01:24:47.500127+00:00"
                },
                "type": "ticket",
                "id": "3",
                "links": {
                    "self": "/v1/tickets/1"
                }
            },
            "jsonapi": {
                "version": "1.0"
            },
            "links": {
                "self": "/v1/tickets/1"
            }
        }


## Ticket Details [/v1/tickets/{ticket_id}]
+ Parameters
    + ticket_id: 1 (integer) - ID of the ticket in the form of an integer

### Ticket Details [GET]
Get a single ticket.

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
            "data": {
                "relationships": {
                    "ticket-tags": {
                        "links": {
                            "self": "/v1/tickets/1/relationships/ticket-tags",
                            "related": "/v1/tickets/1/ticket-tags"
                        }
                    },
                    "access-codes": {
                        "links": {
                            "self": "/v1/tickets/1/relationships/access-codes",
                            "related": "/v1/tickets/1/access-codes"
                        }
                    },
                    "discount-codes": {
                        "links": {
                            "self": "/v1/tickets/1/relationships/discount-codes",
                            "related": "/v1/tickets/1/discount-codes"
                        }
                    },
                    "event": {
                        "links": {
                            "self": "/v1/tickets/1/relationships/event",
                            "related": "/v1/tickets/1/event"
                        }
                    }
                },
                "attributes": {
                    "description": "some description",
                    "type": "VIP-ticket",
                    "price": 100,
                    "name": "ticket-name",
                    "max-order": 100,
                    "is-description-visible": false,
                    "is-checkin-restricted": "true",
                    "auto-checkin-enabled": "false",
                    "is-fee-absorbed": false,
                    "position": 1,
                    "quantity": 100,
                    "is-hidden": false,
                    "deleted-at": null,
                    "sales-ends-at": "2017-06-30T00:24:47.500127+00:00",
                    "min-order": 1,
                    "sales-starts-at": "2017-06-01T01:24:47.500127+00:00"
                },
                "type": "ticket",
                "id": "1",
                "links": {
                    "self": "/v1/tickets/1"
                }
            },
            "jsonapi": {
                "version": "1.0"
            },
            "links": {
                "self": "/v1/tickets/1"
            }
        }


### Update Ticket [PATCH]
Update a single ticket by `id`.

+ `id` (integer) - ID of the record to update **(required)**

+ Request (application/vnd.api+json)

    + Headers

            Authorization: JWT <Auth Key>

    + Body

            {
              "data": {
                "attributes": {
                  "name": "ticket-name",
                  "description": "some description",
                  "type": "VIP-ticket",
                  "price": "100.00",
                  "quantity": "100",
                  "is-description-visible": "false",
                  "is-checkin-restricted": "true",
                  "auto-checkin-enabled": "false",
                  "position": "1",
                  "is-fee-absorbed": "false",
                  "sales-starts-at": "2017-06-01T01:24:47.500127+00:00",
                  "sales-ends-at": "2017-06-30T00:24:47.500127+00:00",
                  "is-hidden": "false",
                  "min-order": "5",
                  "max-order": "100"
                },
                "type": "ticket",
                "id": "1"
              }
            }

+ Response 200 (application/vnd.api+json)

        {
            "data": {
                "relationships": {
                    "ticket-tags": {
                        "links": {
                            "self": "/v1/tickets/1/relationships/ticket-tags",
                            "related": "/v1/tickets/1/ticket-tags"
                        }
                    },
                    "access-codes": {
                        "links": {
                            "self": "/v1/tickets/1/relationships/access-codes",
                            "related": "/v1/tickets/1/access-codes"
                        }
                    },
                    "discount-codes": {
                        "links": {
                            "self": "/v1/tickets/1/relationships/discount-codes",
                            "related": "/v1/tickets/1/discount-codes"
                        }
                    },
                    "event": {
                        "links": {
                            "self": "/v1/tickets/1/relationships/event",
                            "related": "/v1/tickets/1/event"
                        }
                    }
                },
                "attributes": {
                    "description": "some description",
                    "type": "VIP-ticket",
                    "price": 100,
                    "name": "ticket-name",
                    "max-order": 100,
                    "is-description-visible": false,
                    "is-checkin-restricted": "true",
                    "auto-checkin-enabled": "false",
                    "is-fee-absorbed": false,
                    "position": 1,
                    "quantity": 100,
                    "is-hidden": false,
                    "deleted-at": null,
                    "sales-ends-at": "2017-06-30T00:24:47.500127+00:00",
                    "min-order": 5,
                    "sales-starts-at": "2017-06-01T01:24:47.500127+00:00"
                },
                "type": "ticket",
                "id": "1",
                "links": {
                    "self": "/v1/tickets/1"
                }
            },
            "jsonapi": {
                "version": "1.0"
            },
            "links": {
                "self": "/v1/tickets/1"
            }
        }

### Delete Ticket [DELETE]
Delete a single ticket.

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
          "meta": {
            "message": "Object successfully deleted"
          },
          "jsonapi": {
            "version": "1.0"
          }
        }


## List Tickets under an Event [/v1/events/{event_identifier}/tickets{?page%5bsize%5d,page%5bnumber%5d,sort,filter}]
+ Parameters
    + event_identifier: 1 (string) - identifier or event id of the event. (b8324ae2 is an example of identifier)
    + page%5bsize%5d (optional, integer, `10`) - Maximum number of resources in a single paginated response.
    + page%5bnumber%5d (optional, integer, `2`) - Page number to fetched for the paginated response.
    + sort (optional, string, `sales-starts-at`) - Sort the resources according to the given attribute in ascending order. Append '-' to sort in descending order.
    + filter (optional, string, `[]`) - Filter according to the flask-rest-jsonapi filtering system. Please refer: http://flask-rest-jsonapi.readthedocs.io/en/latest/filtering.html for more.


### List Tickets under an Event [GET]

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)


        {
            "meta": {
                "count": 1
            },
            "data": [
                {
                    "relationships": {
                        "ticket-tags": {
                            "links": {
                                "self": "/v1/tickets/1/relationships/ticket-tags",
                                "related": "/v1/tickets/1/ticket-tags"
                            }
                        },
                        "access-codes": {
                            "links": {
                                "self": "/v1/tickets/1/relationships/access-codes",
                                "related": "/v1/tickets/1/access-codes"
                            }
                        },
                        "discount-codes": {
                            "links": {
                                "self": "/v1/tickets/1/relationships/discount-codes",
                                "related": "/v1/tickets/1/discount-codes"
                            }
                        },
                        "event": {
                            "links": {
                                "self": "/v1/tickets/1/relationships/event",
                                "related": "/v1/tickets/1/event"
                            }
                        }
                    },
                    "attributes": {
                        "description": "some description",
                        "type": "VIP-ticket",
                        "price": 100,
                        "name": "ticket-name",
                        "max-order": 100,
                        "is-description-visible": false,
                        "is-checkin-restricted": "true",
                        "auto-checkin-enabled": "false",
                        "is-fee-absorbed": false,
                        "position": 1,
                        "quantity": 100,
                        "is-hidden": false,
                        "deleted-at": null,
                        "sales-ends-at": "2017-06-30T00:24:47.500127+00:00",
                        "min-order": 1,
                        "sales-starts-at": "2017-06-01T01:24:47.500127+00:00"
                    },
                    "type": "ticket",
                    "id": "1",
                    "links": {
                        "self": "/v1/tickets/1"
                    }
                }
            ],
            "jsonapi": {
                "version": "1.0"
            },
            "links": {
                "self": "/v1/events/1/tickets"
            }
        }


## List Tickets under a Ticket-tag [/v1/ticket-tags/{ticket_tag_id}/tickets{?page%5bsize%5d,page%5bnumber%5d,sort,filter}]
+ Parameters
    + ticket_tag_id: 1 (string) - id of the ticket-tag in integer.
    + page%5bsize%5d (optional, integer, `10`) - Maximum number of resources in a single paginated response.
    + page%5bnumber%5d (optional, integer, `2`) - Page number to fetched for the paginated response.
    + sort (optional, string, `sales-starts-at`) - Sort the resources according to the given attribute in ascending order. Append '-' to sort in descending order.
    + filter (optional, string, `[]`) - Filter according to the flask-rest-jsonapi filtering system. Please refer: http://flask-rest-jsonapi.readthedocs.io/en/latest/filtering.html for more.


### List Tickets under a Ticket-tag [GET]

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)


        {
            "meta": {
                "count": 1
            },
            "data": [
                {
                    "relationships": {
                        "ticket-tags": {
                            "links": {
                                "self": "/v1/tickets/1/relationships/ticket-tags",
                                "related": "/v1/tickets/1/ticket-tags"
                            }
                        },
                        "access-codes": {
                            "links": {
                                "self": "/v1/tickets/1/relationships/access-codes",
                                "related": "/v1/tickets/1/access-codes"
                            }
                        },
                        "discount-codes": {
                            "links": {
                                "self": "/v1/tickets/1/relationships/discount-codes",
                                "related": "/v1/tickets/1/discount-codes"
                            }
                        },
                        "event": {
                            "links": {
                                "self": "/v1/tickets/1/relationships/event",
                                "related": "/v1/tickets/1/event"
                            }
                        }
                    },
                    "attributes": {
                        "description": "some description",
                        "type": "VIP-ticket",
                        "price": 100,
                        "name": "ticket-name",
                        "max-order": 100,
                        "is-description-visible": false,
                        "is-checkin-restricted": "true",
                        "auto-checkin-enabled": "false",
                        "is-fee-absorbed": false,
                        "position": 1,
                        "quantity": 100,
                        "is-hidden": false,
                        "deleted-at": null,
                        "sales-ends-at": "2017-06-30T00:24:47.500127+00:00",
                        "min-order": 1,
                        "sales-starts-at": "2017-06-01T01:24:47.500127+00:00"
                    },
                    "type": "ticket",
                    "id": "1",
                    "links": {
                        "self": "/v1/tickets/1"
                    }
                }
            ],
            "jsonapi": {
                "version": "1.0"
            },
            "links": {
                "self": "/v1/ticket-tags/1/tickets"
            }
        }


## List Tickets for an Access Code [/v1/access-codes/{access_code_id}/tickets{?page%5bsize%5d,page%5bnumber%5d,sort,filter}]
+ Parameters
    + access_code_id: 1 (integer) - ID of the access code in the form of an integer
    + page%5bsize%5d (optional, integer, `10`) - Maximum number of resources in a single paginated response.
    + page%5bnumber%5d (optional, integer, `2`) - Page number to fetched for the paginated response.
    + sort (optional, string, `sales-starts-at`) - Sort the resources according to the given attribute in ascending order. Append '-' to sort in descending order.
    + filter (optional, string, `[]`) - Filter according to the flask-rest-jsonapi filtering system. Please refer: http://flask-rest-jsonapi.readthedocs.io/en/latest/filtering.html for more.


### List Tickets for an Access Code [GET]

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)


        {
            "meta": {
                "count": 1
            },
            "data": [
                {
                    "relationships": {
                        "ticket-tags": {
                            "links": {
                                "self": "/v1/tickets/1/relationships/ticket-tags",
                                "related": "/v1/tickets/1/ticket-tags"
                            }
                        },
                        "access-codes": {
                            "links": {
                                "self": "/v1/tickets/1/relationships/access-codes",
                                "related": "/v1/tickets/1/access-codes"
                            }
                        },
                        "discount-codes": {
                            "links": {
                                "self": "/v1/tickets/1/relationships/discount-codes",
                                "related": "/v1/tickets/1/discount-codes"
                            }
                        },
                        "event": {
                            "links": {
                                "self": "/v1/tickets/1/relationships/event",
                                "related": "/v1/tickets/1/event"
                            }
                        }
                    },
                    "attributes": {
                        "description": "some description",
                        "type": "VIP-ticket",
                        "price": 100,
                        "name": "ticket-name",
                        "max-order": 100,
                        "is-description-visible": false,
                        "is-checkin-restricted": "true",
                        "auto-checkin-enabled": "false",
                        "is-fee-absorbed": false,
                        "position": 1,
                        "quantity": 100,
                        "is-hidden": false,
                        "deleted-at": null,
                        "sales-ends-at": "2017-06-30T00:24:47.500127+00:00",
                        "min-order": 1,
                        "sales-starts-at": "2017-06-01T01:24:47.500127+00:00"
                    },
                    "type": "ticket",
                    "id": "1",
                    "links": {
                        "self": "/v1/tickets/1"
                    }
                }
            ],
            "jsonapi": {
                "version": "1.0"
            },
            "links": {
                "self": "/v1/access-codes/1/tickets"
            }
        }

## List Tickets for a Discount Code [/v1/discount-codes/{discount_code_id}/tickets{?page%5bsize%5d,page%5bnumber%5d,sort,filter}]
+ Parameters
    + discount_code_id: 1 (integer) - ID of the discount code in the form of an integer
    + page%5bsize%5d (optional, integer, `10`) - Maximum number of resources in a single paginated response.
    + page%5bnumber%5d (optional, integer, `2`) - Page number to fetched for the paginated response.
    + sort (optional, string, `sales-starts-at`) - Sort the resources according to the given attribute in ascending order. Append '-' to sort in descending order.
    + filter (optional, string, `[]`) - Filter according to the flask-rest-jsonapi filtering system. Please refer: http://flask-rest-jsonapi.readthedocs.io/en/latest/filtering.html for more.


### List Tickets for a Discount Code [GET]

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
            "data": [
                {
                    "type": "ticket",
                    "attributes": {
                        "sales-ends-at": "2017-06-30T00:24:47.500127+00:00",
                        "type": "VIP-ticket",
                        "price": 100,
                        "quantity": 100,
                        "is-description-visible": false,
                        "deleted-at": null,
                        "name": "some-ticket-name",
                        "max-order": 100,
                        "min-order": 1,
                        "description": "some description",
                        "sales-starts-at": "2017-06-01T01:24:47.500127+00:00",
                        "is-hidden": false,
                        "is-fee-absorbed": false,
                        "position": 1
                    },
                    "relationships": {
                        "attendees": {
                            "links": {
                                "self": "/v1/tickets/1/relationships/attendees",
                                "related": "/v1/attendees?ticket_id=1"
                            }
                        },
                        "access-codes": {
                            "links": {
                                "self": "/v1/tickets/1/relationships/access-codes",
                                "related": "/v1/tickets/1/access-codes"
                            }
                        },
                        "discount-codes": {
                            "links": {
                                "self": "/v1/tickets/1/relationships/discount-codes",
                                "related": "/v1/tickets/1/discount-codes"
                            }
                        },
                        "event": {
                            "links": {
                                "self": "/v1/tickets/1/relationships/event",
                                "related": "/v1/tickets/1/event"
                            }
                        },
                        "ticket-tags": {
                            "links": {
                                "self": "/v1/tickets/1/relationships/ticket-tags",
                                "related": "/v1/tickets/1/ticket-tags"
                            }
                        }
                    },
                    "id": "1",
                    "links": {
                        "self": "/v1/tickets/1"
                    }
                }
            ],
            "links": {
                "self": "/v1/discount-codes/1/tickets"
            },
            "meta": {
                "count": 1
            },
            "jsonapi": {
                "version": "1.0"
            }
        }

## List Tickets for an Order [/v1/orders/{order_identifier}/tickets]
+ Parameters
    + order_identifier: 7201904e (string) - Indetifier of the order

### List Tickets for an Order [GET]

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
          "meta": {
            "count": 1
          },
          "data": [
            {
              "relationships": {
                "ticket-tags": {
                  "links": {
                    "self": "/v1/tickets/1/relationships/ticket-tags",
                    "related": "/v1/tickets/1/ticket-tags"
                  }
                },
                "event": {
                  "links": {
                    "self": "/v1/tickets/1/relationships/event",
                    "related": "/v1/tickets/1/event"
                  }
                },
                "discount-codes": {
                    "links": {
                        "self": "/v1/tickets/1/relationships/discount-codes",
                        "related": "/v1/tickets/1/discount-codes"
                    }
                }
              },
              "attributes": {
                "description": "some description",
                "type": "VIP-ticket",
                "price": 100.0,
                "name": "ticket-name0",
                "max-order": 100,
                "is-description-visible": true,
                "is-checkin-restricted": "true",
                "auto-checkin-enabled": "false",
                "is-fee-absorbed": true,
                "position": 1,
                "quantity": 100,
                "is-hidden": false,
                "deleted-at": null,
                "sales-ends-at": "2018-06-30T00:24:47.500127+00:00",
                "min-order": 1,
                "sales-starts-at": "2017-06-01T01:24:47.500127+00:00"
              },
              "type": "ticket",
              "id": "1",
              "links": {
                "self": "/v1/tickets/1"
              }
            }
          ],
          "jsonapi": {
            "version": "1.0"
          },
          "links": {
            "self": "/v1/orders/7201904e-c695-4251-a30a-61765a37ff24/tickets"
          }
        }
